/**
 * 
 */
package diary;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.LayoutManager;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JButton;

import note.NoteListPanel;
import note.NotebookListPanel;

/**
 * @author haiyuzha
 *
 */
public class DiaryPanel extends JPanel {

	/**
	 * 
	 */
	public DiaryPanel() {
		setLayout(new BorderLayout());

		// Notebook list
		DiaryHeadListPanel diaryHeadListPanel = new DiaryHeadListPanel();

		// Text area
		JTextArea textArea = new JTextArea("A brand new has began, let's open our brace and embark\n" +
				" the bright future. We're destined to build a whole different new world.\n" +
				" Let's go!");

		JScrollPane areaScrollPane = new JScrollPane(textArea);
		areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		areaScrollPane.setPreferredSize(new Dimension(100, 60));
		areaScrollPane.setBorder(BorderFactory.createCompoundBorder(
				BorderFactory.createTitledBorder("Plain text"), 
				BorderFactory.createEmptyBorder(5, 5, 5, 5)));

		JButton b = new JButton("Save");
		
		add(diaryHeadListPanel, BorderLayout.WEST);
		add(areaScrollPane, BorderLayout.CENTER);
		add(b, BorderLayout.EAST);
		
		diaryHeadListPanel.addMouseListener(new MouseHandler(textArea));
	}

	/**
	 * @param layout
	 */
	public DiaryPanel(LayoutManager layout) {
		super(layout);
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param isDoubleBuffered
	 */
	public DiaryPanel(boolean isDoubleBuffered) {
		super(isDoubleBuffered);
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param layout
	 * @param isDoubleBuffered
	 */
	public DiaryPanel(LayoutManager layout, boolean isDoubleBuffered) {
		super(layout, isDoubleBuffered);
		// TODO Auto-generated constructor stub
	}

}
